#coding:utf-8

#文字列(string)の基本とfor文の利用
#N.SUN 2022/11/24

#文字列 string はpythonオブジェクトの一つ

'''
Strings in python are surrounded by either single quotation marks,or double quotation marks.
'hello' is the same as "hello".
You can display a string literal with the print() function:

Python の文字列は、一重引用符または二重引用符で囲まれます。
'hello'は"hello"と同じです。
print() 関数を使用して文字列リテラル(literal、ありのままの)を表示できます。
'''

print('Hello')

a = "abc"
b = a

print(type(a))
print(a,b)

input("ちょっと待って、見るよ、Enterキーで次へ")


#You can assign a multiline string to a variable by using three quotes:
#Note: in the result, the line breaks are inserted 
#at the same position as in the code.

#ラテン語
a1 = """Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.\n"""
print(a)

# Or three single quotes:

a2 = ''' 
唐 王之渙
 登鸛雀樓

白日依山盡,
黄河入海流。
欲窮千里目,
更上一層樓。\n'''

print(a1)
print(a2)
input("ちょっと待って、見るよ、Enterキーで次へ")

import os
os.system("clear")
#電子掲示板
import time

a = "湯豆腐や いのちのはての うすあかり"
print(a)

for x in a:
    print(x)
    time.sleep(1)
 
b = "薄日とは 美しきもの 帰り花 "
print(b)

  
for x in b:
    print("\r"+x,end="")
    time.sleep(1)
print("\n")
    
str = ""    
for x in b:
    str += x
    print("\r"+str,end="")
    time.sleep(1)
print("\n")

os.system("clear")
str = ""    
for x in a1:
    str += x
    print("\r"+str+"\033[6A",end="")
    time.sleep(1)
print("\n\n\n\n")

os.system("clear")
str = ""    
for x in a2:
    str += x
    print("\r"+str+"\033[8A",end="")
    time.sleep(1)
print("\n\n\n\n\n\n\n\n")

            
デモ part1
デモ part2
デモ part3
デモ part4